package com.morehair.controller.admin;

import com.morehair.bean.vo.admin.BaseRespVo;
import com.morehair.bean.vo.admin.GoodsStatVo;
import com.morehair.bean.vo.admin.OrderStatVo;
import com.morehair.bean.vo.admin.UserStarVo;
import com.morehair.service.admin.StatisticstService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author: DLX
 * @Date: 2021/6/6 21:24
 * @Description:
 **/

@RestController
@RequestMapping("admin/stat")
public class StatisticsController {

    @Autowired
    StatisticstService statisticstService;

    @RequestMapping("user")
    @RequiresPermissions("admin:stat:user")
    public BaseRespVo statUser() {
        UserStarVo userStarVo=statisticstService.statUser();
        return BaseRespVo.ok(userStarVo);
    }

    @RequestMapping("order")
    @RequiresPermissions("admin:stat:order")
    public BaseRespVo statOrder() {
        OrderStatVo orderStatVo=statisticstService.statOrder();
        return BaseRespVo.ok(orderStatVo);
    }

    @RequestMapping("goods")
    @RequiresPermissions("admin:stat:goods")
    public BaseRespVo statGoods() {
        GoodsStatVo goodsrStatVo=statisticstService.statGoods();
        return BaseRespVo.ok(goodsrStatVo);
    }

}
